﻿using System.Collections.Generic;
using personalplaner.business.stamm;
using personalplaner.common.controls;
using personalplaner.gui.stamm.viewmodels;

namespace personalplaner.gui.stamm.windows
{
    /// <summary>
    /// Interaction logic for AddPersonToSchemaDialog.xaml
    /// </summary>
    public partial class AddPersonToSchema : WindowExt
    {
        public AddPersonToSchema(IEnumerable<Abteilung> abteilungen, IEnumerable<PlanSchemaItem> planLayout)
        {
            InitializeComponent();

            var dc = DataContext as AddPersonToSchemaViewModel;
            if (dc == null)
                return;

            dc.Abteilungen = abteilungen;
			dc.PlanLayout = planLayout;
        }

		public Abteilung SelectedAbteilung
		{
			get
			{
				var dc = DataContext as AddPersonToSchemaViewModel;
				if (dc != null)
					return dc.SelectedAbteilung;

				return null;
			}
		}

		public Person SelectedPerson
		{
			get
			{
				var dc = DataContext as AddPersonToSchemaViewModel;
				if (dc != null)
					return dc.SelectedPerson;

				return null;
			}
		}

		public bool IsEmptyRow
		{
			get
			{
				var dc = DataContext as AddPersonToSchemaViewModel;
				if (dc != null)
					return dc.IsEmptyRow;

				return true;
			}
		}
    }
}
